home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / util / boot / ConsoleFix.lha / ConsoleFix / ConsoleFix.readme < prev    next >
Encoding:
Text File  |  1999-10-17  |  3.3 KB  |  101 lines

  1. Short:    Fix a bug in the console.device
  2. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  3. Author:   thor@math.tu-berlin.de (Thomas Richter)
  4. Type:     util/boot
  5. Version:  1.01.1
  6. Requires: Os 3.0 (V39) or better
  7.  
  8. _____________________________________________________________________________
  9.  
  10. Changes made in release 1.01.1:
  11.  
  12. - Included the updated assembly source of the 1.01 release. Ooops.
  13.  
  14. _____________________________________________________________________________
  15.  
  16. Changes made in release 1.01:
  17.  
  18. -ConsoleFix 1.00 failed from time to time if the console.device main task was, 
  19. due to some unfortune, not waiting in its main loop. Added a workaround
  20. that checks several times.
  21.  
  22. -Added a version tag.
  23. _____________________________________________________________________________
  24.  
  25.  
  26. Purpose of this program:
  27.  
  28. This little patch fixes possible crashes of the console.device task, which,
  29. luckely, do not show up under "normal" circumstances. However, as soon as
  30. the console.device supervisor task takes more stack than usual, or this
  31. stack is filled by more than just zeros, the console device will crash on
  32. window resizes.
  33.  
  34. The reason for this crash is that the console.device main task uses a
  35. faulty algorithm to traverse an exec style list: The list header is
  36. also processed as a "node". Due to some lucky coincidences, the only data
  37. that gets querried by this faulty node is on the stack of the console device,
  38. and again due to some coincidence, this points to an area of the stack which
  39. is usually set to zero. All provided the stack of the console.device doesn't 
  40. grow too much.
  41.  
  42. For the experts: 
  43.  
  44.     The main loop of the console device looks like this:
  45.  
  46.     lea WindowList(a6),a2        ;get the head of the window list
  47. .loop:
  48.     bsr ProcessWindow        ;re-calcutes the window on a resize
  49.  
  50.     move.l (a2),a2            ;get next node
  51.     tst.l (a2)            ;end of list?
  52.     bne.s .loop
  53.  
  54. Hence, the list header is processed as a first node. Urgh!
  55.  
  56.  
  57. The correct method would have been:
  58.  
  59.  
  60.     lea WindowList(a6),a2        ;get the head of the window list
  61.     bra.s .into
  62. .loop:
  63.     bsr ProcessWindow        ;re-calcutes the window on a resize
  64. .into:
  65.     move.l (a2),a2            ;get next node
  66.     tst.l (a2)            ;end of list?
  67.     bne.s .loop
  68.  
  69.  
  70. This program fixes this bug by "hacking in" a new main loop for the console
  71. device, the source code is included.
  72.  
  73. I'm sorry for the uglyness of this patch, it was designed at 2 a.m. in the
  74. night and I was all than awake. It currently works like it is, but I'd really
  75. prefer if someone could write a "nicer" fix, or if AI would include this fix
  76. in the "SetPatch" program.
  77.  
  78. _____________________________________________________________________________
  79.  
  80. Credits:
  81.  
  82. Thanks goes to Nils Goers and his StackSnoop program. This console.device
  83. problem showed up while Nils was beta-testing his program, and I was
  84. curious what could have caused the crash. Stack-Snoop fills the application
  85. stack with a "magic cookie" to find out the true stack size a program re-
  86. quires, and this magic cookie caused the buggy code above to get mad.
  87. Always interested in the true reason for a crash, I found the above bug...
  88.  
  89. _____________________________________________________________________________
  90.  
  91. Copyright:
  92.  
  93.     None, this is freeware, public domain. Do whatever you want to do
  94.     with it.
  95.  
  96. _____________________________________________________________________________
  97.  
  98.  
  99. Thomas,
  100.     October 1999
  101.